import { call, put, takeEvery } from 'redux-saga/effects';
import api from '../../api/api';
import types from './types';

function* getAccountList(action) {
  const { data: res } = yield call(api.users.getAccountList);
  // console.log(res);
  yield put({ type: types.GET_ACCOUNTS_LIST, payload: res.data });
}

function* watchGetAccountList() {
  yield takeEvery('getAccountListAsync', getAccountList);
}

export default watchGetAccountList;
